package inner;

import com.sun.xml.internal.bind.v2.runtime.output.FastInfosetStreamWriterOutput;

import javax.swing.*;
class Monther
{
    public static int age;
    public int month;
    public static String name="li";   //1

    {                                //3
        age=1;


        System.out.println("实例代码块");
    }
    static                             //2
    {
        name="wang";
        System.out.println("静态代码块");
    }
    static
    {
      age++;
      name="xiao";
        System.out.println("也是静态代码块");//4
    }

    public Monther()                  //5
    {
        System.out.println("不带参数的构造方法");
    }












}





class Girl
{
    int age=7;
    String hobby="打篮球";
    public void fun()
    {
        System.out.println("age="+age+" "+"hobby="+hobby);
    }
}

class Student
{
    public int age;
    public String name;
    public String grade;
    public void set(int age,String name,String grade)
    {
        this.age=age;
        this.name=name;
        this.grade=grade;
    }
    public void pint()
    {
        System.out.println(age+" "+name+" "+grade);
    }
    public void fun()
    {
        this.pint();
        System.out.println("哇塞！");
    }
    public Student()
    {
        //System.out.println("不带参数的构造方法");
        this(7,"wang","java7"); //这里可以通过this这个语句来给参数赋值，但是这个语句必须在第一行
        pint();

    }
    public Student(int age,String name,String grade)
    {
        System.out.println("带参数的构造方法");
        this.age=age;
        this.name=name;
        this.grade=grade;
        pint();
    }




}
class Dog
{
    public int age;
    public String name;
    public void set(int age,String name)
    {
        age=age;
        name=name;
    }
    public void dayin()
    {
        System.out.println(age);
        System.out.println(name);
    }
    public void bark()
    {
        System.out.println("狗叫");

    }
    public void eat()
    {
        System.out.println("狗吃");
    }

}





public class text {
    public static void main198(String[] args) {
       String a= Monther.name;
        System.out.println(a);
    }

    public static void main(String[] args) {
        Monther monther1=new Monther();
        System.out.println(Monther.age);
        System.out.println(Monther.name);






    }

    public static void main11(String[] args) {
        Girl girl=new Girl();
        girl.fun();
    }
    public static void main333(String[] args) {
        //Student student1=new Student(7,"wang","java7");
        Student student2=new Student();


    }
    public static void main8(String[] args) {
        Student student1=new Student();
        Student student2=new Student();
        student1.set(11,"wang","java106");
        student2.set(12,"li","java107");
        student1.fun();
        student2.fun();



    }

    public static void main3(String[] args) {
        Dog dog3=new Dog();
        System.out.println(dog3.age+" "+dog3.name);
    }
    public static void main2(String[] args) {
        Dog dog1=new Dog();
        Dog dog2=new Dog();
        dog1.set(3,"wang");
        dog2.set(4,"li");
        dog1.dayin();
        dog2.dayin();



    }
    public static void main1(String[] args) {
        Dog dog=new Dog();
        dog.age=3;
        dog.name="wang";
        System.out.println(dog.age);
        System.out.println(dog.name);
        dog.bark();
        dog.eat();




    }
}
